package com.armed.client.interfaz.teldir;

import init.org.util.Constants;
import java.awt.Component;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

/**
 * Class ColumnIdTableRenderer
 *
 *
 * @author init() software
 * @version 03/02/2008 
 */
public class ColumnIdTableRenderer extends DefaultTableCellRenderer 
{
    @Override
    public Component getTableCellRendererComponent(JTable table, Object value,boolean isSelected, boolean hasFocus, int row, int column) 
    {
        Component component = super.getTableCellRendererComponent(table, value,isSelected, hasFocus, row, column);
        ((JLabel) component).setIcon(new ImageIcon(getClass().getResource(Constants.ID_ICON)));
        ((JLabel) component).setHorizontalAlignment(JLabel.LEFT);
        if (value != null && value instanceof Integer)
        {
            int aux = (Integer) value;
            ((JLabel) component).setText(String.valueOf(aux));
            return component;
        }
        return component;
    }
}
